<style>
    .form-group .col-sm-4{
        padding-bottom: 5px;
    }
    .nav-tabs{
        border-bottom: unset;
    }
</style>

<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
    <div class="col-md-6 col-sm-12">
        <div class="panel panel-default ">
            <div class="panel-heading">
                <div class="panel-lead">
                    <div class="panel-title">
                        <span style="font-weight: bold;font-style: normal;">{:__('基本信息')}</span>
                        <span class="label label-primary pull-right"><a href="javascript:parent.Fast.api.open('facrm/business/index/edit/ids/{$row.id}',__('修改商机信息-')+'{$row.name}');"> {:__('修改')}</a></span>
                    </div>
                </div>
            </div>
            <div class="panel-body" style="min-height: 250px;">
                <div class="tab-content">
                    <div class="tab-pane fade active in" id="extra">
                        <div class="form-group">
                            <label for="c-name" class="control-label col-xs-12 col-sm-2">{:__('商机名称')}:</label>
                            <div class="col-xs-12 col-sm-8">
                                <input id="c-name" readonly type="text" class="form-control" name="crow[name]" value="{$row.name}"  />
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="c-money" class="control-label col-xs-12 col-sm-2">{:__('商机金额')}:</label>
                            <div class="col-xs-12 col-sm-8">
                                <input id="c-money" readonly type="tel"  class="form-control" name="crow[money]" value="{$row.money}"  />
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="c-deal_time" class="control-label col-xs-12 col-sm-2">{:__('预计成交日期')}:</label>
                            <div class="col-xs-12 col-sm-8">
                                <input id="c-deal_time" type="text"  readonly class="form-control  datetimepicker" data-date-format="YYYY-MM-DD HH:mm" name="row[deal_time]" value="{:datetime($row.deal_time)}"  />
                            </div>
                        </div>

                        <div class="form-group">
                            <label for="c-remark" class="control-label col-xs-12 col-sm-2">{:__('备注')}:</label>
                            <div class="col-xs-12 col-sm-8">
                                <input id="c-remark" type="number"  readonly class="form-control" name="row[remark]" value="{$row.remark}"  />
                            </div>
                        </div>

                    </div>
                </div>
            </div>
        </div>
    </div>





    <div class="col-md-6 col-sm-12">
        <div class="panel panel-default panel-success">
            <div class="panel-heading">
                <div class="panel-lead">
                    <span style="font-weight: bold;font-style: normal;">{:__('跟进操作')}</span>
                </div>
            </div>
            <div class="panel-body" style="border: 1px solid #e8edf0;">
                <div class="tab-content">
                    <div class="tab-pane fade active in" id="extra1">
                        <div class="form-group">
                            <label for="record-content" class="control-label col-xs-12 col-sm-2">{:__('跟进内容')}:</label>
                            <div class="col-xs-12 col-sm-8">
                                <textarea id="record-content" class="form-control "  data-rule="required" name="row[content]" rows="2"></textarea>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="c-image" class="control-label col-xs-12 col-sm-2">{:__('附件')}:</label>
                            <div class="col-xs-12 col-sm-8">
                                <div class="input-group">
                                    <input id="c-image" class="form-control" size="50" name="row[image]" type="text" value="" placeholder="可以为空">
                                    <div class="input-group-addon no-border no-padding">
                                        <span><button type="button" id="plupload-image" class="btn btn-danger plupload" data-input-id="c-image" data-mimetype="*" data-multiple="true" data-preview-id="p-image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>

                                    </div>
                                    <span class="msg-box n-right" for="c-image"></span>
                                </div>
                                <ul class="row list-inline plupload-preview" id="p-image"></ul>
                            </div>
                        </div>

                        <div class="form-group">
                            <label for="c-next_time" class="control-label col-xs-12 col-sm-2">{:__('下次跟进时间')}:</label>
                            <div class="col-xs-12 col-sm-8">
                                <input id="c-next_time"  value=""  class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm" data-use-current="true" name="row[next_time]" type="text" >
                                <span class="text-gray">如不需要再跟进设置为空</span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-xs-12 col-sm-2">{:__('跟进方式')}:</label>
                            <div class="col-xs-12 col-sm-8">
                                <div class="input-group">
                                    {:build_select('row[record_type]', $record_type_list,0, ['class'=>'form-control selectpicker', 'data-rule'=>'required'])}
                                    <div class="input-group-addon no-border no-padding normal-footer">
                                        <button type="submit" class="btn btn-success btn-embossed  disabled">{:__('立即保存')}</button>
                                    </div>
                                </div>

                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class="col-md-12 col-sm-12">
    <div class="panel panel-default panel-intro">
        <div class="panel-heading">
            <ul class="nav nav-tabs">

                <li class="active"><a href="#bulletin" role="tab" data-toggle="tab">跟进记录</a></li>
                <li><a href="#customer" role="tab" data-toggle="tab">客户信息</a></li>
                <li><a href="#forum" role="tab" data-toggle="tab">联系人</a></li>
                <li><a href="#product" role="tab"  data-toggle="tab">意向产品</a></li>

            </ul>


        </div>
        <div class="panel-body" style="border-left: 1px solid ;border-right: 1px solid ;border-bottom: 1px solid ;border-color: #e8edf0">
            <div id="myTabContent" class="tab-content">
                <div id="toolbar1" class="toolbar ">
                    <a href="javascript:;" class="btn btn-primary btn-refresh"><i class="fa fa-refresh"></i></a>
                </div>
                <div id="toolbar2" class="toolbar ">
                    <a href="javascript:;" class="btn btn-primary btn-refresh"><i class="fa fa-refresh"></i></a>
                    {if($auth->check('facrm/business/contacts/correlation'))}
                    <a href="javascript:;" data-url="facrm/business/contacts/correlation/customer_id/{$row.customer.id}" class="btn btn-success correlation "
                       title="关联联系人"><i class="fa fa-plus"></i> 关联</a>
                    {/if}

                </div>
                <div id="toolbarproduct" class="toolbar ">


                </div>
                <!-- 跟进记录开始-->
                <div class="tab-pane fade active in" id="bulletin">
                    <table id="tableflow" class="table table-striped table-bordered table-hover" width="100%"></table>
                    <!-- 修改 amplam2018年8月11日 15:40:05--->
                </div>
                <!-- 跟进记录结束-->

                <!-- 客户基本信息开始-->
                <div class="tab-pane fade" id="customer">


                    <div class="row" >
                        <div class="col-xs-12 col-sm-6">
                            <label class="control-label " style="font-weight: bold">{:__('客户名称')}:</label>
                            <label class="control-label " >
                            <a href="javascript:parent.Fast.api.open('facrm/customer/index/detail/ids/{$row.customer_id}',__('客户详情-'));" >{$row.customer.name}</a></label>
                        </div>
                        <div class="col-xs-12 col-sm-6">
                            <label class="control-label " style="font-weight: bold">{:__('客户电话')}:</label>
                            <label class="control-label " >{$row.customer.telephone}</label>
                        </div>
                    </div>
                    <div class="row" >
                        <div class="col-xs-12 col-sm-6">
                            <label class="control-label " style="font-weight: bold">{:__('客户手机')}:</label>
                            <label class="control-label " >{$row.customer.mobile}</label>
                        </div>
                        <div class="col-xs-12 col-sm-6">
                            <label class="control-label " style="font-weight: bold">{:__('客户行业')}:</label>
                            <label class="control-label " > {:isset($industryList[$row.customer.industry])?$industryList[$row.customer.industry]:''}</label>
                        </div>
                    </div>

                    <div class="row" >
                        <div class="col-xs-12 col-sm-6">
                            <label class="control-label " style="font-weight: bold">{:__('客户来源')}:</label>
                            <label class="control-label " >{:isset($sourceList[$row.customer.level])?$sourceList[$row.customer.level]:''}</label>
                        </div>
                        <div class="col-xs-12 col-sm-6">
                            <label class="control-label " style="font-weight: bold">{:__('客户等级')}:</label>
                            <label class="control-label " >{:isset($levelList[$row.customer.level])?$levelList[$row.customer.level]:''}</label>
                        </div>
                    </div>
                    <div class="row" >
                        <div class="col-xs-12 col-sm-12">
                            <label class="control-label " style="font-weight: bold">{:__('客户地址')}:</label>
                            <label class="control-label " >
                                <div class="form-inline" data-toggle="cxselect" data-selects="province,city,area">
                                    <select class="province form-control" name="province" data-url="ajax/area" readonly>
                                        <option value="{$row.customer.province}" selected=""></option>
                                    </select>
                                    <select class="city form-control" name="city" data-url="ajax/area" readonly>
                                        <option value="{$row.customer.city}" selected=""></option>
                                    </select>
                                    <select class="area form-control" name="area" data-url="ajax/area" readonly="">
                                        <option value="{$row.customer.area}" selected=""></option>
                                    </select>
                                    {$row.customer.detail_address}

                                </div>
                            </label>
                        </div>
                    </div>

                    <div class="row" >
                        <div class="col-xs-12 col-sm-12">
                            <label class="control-label " style="font-weight: bold">{:__('客户备注')}:</label>
                            <label class="control-label " >
                                    {$row.customer.remark}
                            </label>
                        </div>
                    </div>


                </div>
                <!-- 客户基本信息结束-->

                <!-- 联系人开始-->
                <div class="tab-pane fade" id="forum">
                    <table id="contact" class="table table-striped table-bordered table-hover" width="100%"></table>
                    <!-- 修改 amplam2018年8月13日 10:30:05--->
                </div>
                <!-- 联系人结束-->


                <!-- 意向产品-->
                <div class="tab-pane fade" id="product">
                    <table id="product_table" class="table table-striped table-bordered table-hover" width="100%"></table>
                </div>
                <!-- 意向产品-->

            </div>
        </div>
    </div>

    </div>

	
    <div class="form-group fixed-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">

            <button type="button" class="btn  btn-send-email  bg-purple {:$auth->check('facrm/apps/email/send')?'':'hide'} "
                    data-url="facrm/apps/email/send"
                    data-types="business"
                    data-typesid="{$row.id}"
                    data-customer_id="{$row.customer_id}"
                    data-title="{:__('发邮件给客户：')}{$row.customer.name}">{:__('发邮件')}</button>

            <button type="button" class="btn  btn-send-sms  btn-info {:$auth->check('facrm/apps/sms/send')?'':'hide'} "
                    data-url="facrm/apps/sms/send"
                    data-types="business"
                    data-typesid="{$row.id}"
                    data-customer_id="{$row.customer_id}"
                    data-title="{:__('发信息给客户：')}{$row.customer.name}">{:__('发信息')}</button>
        </div>
    </div>
</form>
<script>
    var business_id={:input('ids')};
    var record_type_list={:json_encode($record_type_list)};
</script>




